home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8418 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: access1.digex.net!not-for-mail
  2. From: ell@access1.digex.net (Ell)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Pure Virtual Destructor Question
  5. Date: 18 Feb 1996 00:10:18 GMT
  6. Organization: The Universe
  7. Message-ID: <4g5qpa$lhk@news4.digex.net>
  8. References: <4fas7a$7ns@comet2.magicnet.net> <4fecq0$k4e@news4.digex.net> <rcauvin-0902960901140001@quadostimpy.natinst.com> <4fp5r2$dm2@news4.digex.net> <4g2lpo$f81@druid.borland.com>
  9. NNTP-Posting-Host: access1.digex.net
  10. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  11.  
  12. Pete Becker (pete@borland.com) wrote:
  13. : In article <4fp5r2$dm2@news4.digex.net>, ell@access1.digex.net says...
  14. : >
  15. : >Roger L. Cauvin (rcauvin@natinst.com) wrote:
  16. : >: In article <4fecq0$k4e@news4.digex.net>, ell@access4.digex.net (Ell) wrote:
  17. : >: 
  18. : >: >It is _illegal_ to logically, or physically "define" a pure
  19. : >: > virtual function in the class it is "declared" in.  A pure virtual should
  20. : >: > only be defined in classes derived from the class where the pure virtual
  21. : >: > is declared.  Only derived classes should "do some destructor stuff".
  22. : >: 
  23. : >: Actually, it is acceptable to define a pure virtual function in the class
  24. : >: in which it is declared.  Pure virtual destructors are a special case;
  25. : >: they MUST be defined in the class in which they are declared.
  26. : >
  27. : >Yes, a pure virtual dtor MUST be _defined_ as a member of the class it is
  28. : >declared in.  As dtors are not inherited by derived classes, the only
  29. : >place to override the pure virtual declaration for a class is as a member
  30. : >of the class (though it must actually be defined outside of the class
  31. : >declaration).  
  32. : >
  33. : The issue is not whether you have a place to override it. The issue is 
  34. : whether 
  35. : it is actually called.
  36.  
  37. It seems to me that regardless of it actually being called, there is no
  38. other place to define a pure virtual dtor, but as a member outside of the
  39. class it is declared in. 
  40.  
  41. : >Still a class with a single pure virtual declaration, such as a pure
  42. : >virtual dtor declaration is considered to be 'abstract' even with the
  43. : >"outside of class declaration" definition of the pure virtual dtor. 
  44.  
  45. : Yes, but this is just a specific example of the general rule that any class 
  46. : with a pure virtual function is abstract, even if you provide a definition 
  47. : for 
  48. : that function.
  49.  
  50. That seems to me to be what I just said above this.
  51.  
  52. Elliott
  53.  
  54.